#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void left_twist(char* p, int len, int k1)
{
	int k = k1 % len;
	char* p2 = (char*)malloc(2 * len * sizeof(char));
	strcpy(p2, p);
	strcpy(p2+len, p);
	for (int i = 0; i < len; i++)
	{
		p[i] = p2[i + k];
	}
}
int main()
{
	char ch[100];
	scanf("%s", ch);
	int len = strlen(ch);
	int k = 0;
	scanf("%d", &k);
	left_twist(ch, len, k);
	printf("%s", ch);
	return 0;
}